package binaryTree.basic;

import binaryTree.TreeNode;

public class IsSameTree {

    public boolean isSametree(TreeNode root, TreeNode subRoot){
        if(root == null &&subRoot == null){
            return true;
        }
        if(root == null || subRoot == null){
            return false;
        }
        if(root.val != subRoot.val){
            return false;
        }
        return isSametree(root.right,subRoot.right)&&isSametree(root.left,subRoot.left);
    }

}


